Skip to content

Rename caller/user attributes to align with OTel conventions#223

Merged
fpfp100 merged 2 commits intomainfrom
users/pefan/updateuser
Mar 24, 2026
Merged

Rename caller/user attributes to align with OTel conventions#223
fpfp100 merged 2 commits intomainfrom
users/pefan/updateuser

Conversation

@fpfp100
Copy link
Copy Markdown
Contributor

@fpfp100 fpfp100 commented Mar 23, 2026

Summary

  • Rename caller dimension constants from microsoft.caller.* to OTel standard user.* namespace (user.id, user.name, user.email)
  • Rename agent UPN constants to use email terminology (microsoft.agent.user.email, microsoft.a365.caller.agent.user.email)
  • Rename data contract properties: CallerDetails (callerIduserId, callerUpnuserEmail, callerNameuserName), AgentDetails (agentUPNagentEmail)
  • Rename BaggageBuilder methods: callerId()userId(), callerName()userName(), callerUpn()userEmail(), agentUpn()agentEmail()
  • Update all consumers and tests across agents-a365-observability and agents-a365-observability-hosting

Aligns with .NET SDK changes in microsoft/Agent365-dotnet#219

Test plan

  • pnpm build passes (all 11 packages, CJS + ESM)
  • pnpm test passes (57 suites, 1078 tests)
  • No stale references to old constant names, property names, or method names
  • CI integration tests pass

🤖 Generated with Claude Code

… SDK

1. Rename caller dimension constants to user.* namespace:
   - CallerIdKey (microsoft.caller.id) -> UserIdKey (user.id)
   - CallerUpnKey (microsoft.caller.upn) -> UserEmailKey (user.email)
   - CallerNameKey (microsoft.caller.name) -> UserNameKey (user.name)
2. Rename agent UPN constants to use email:
   - AgentUPNKey (microsoft.agent.user.upn) -> AgentEmailKey (microsoft.agent.user.email)
   - CallerAgentUPNKey (microsoft.a365.caller.agent.user.upn) -> CallerAgentEmailKey (microsoft.a365.caller.agent.user.email)
3. Rename data contract properties:
   - CallerDetails: callerId -> userId, callerUpn -> userEmail, callerName -> userName
   - AgentDetails: agentUPN -> agentEmail
4. Rename BaggageBuilder methods:
   - callerId() -> userId(), callerName() -> userName(), callerUpn() -> userEmail(), agentUpn() -> agentEmail()
5. Update all consumers: scopes, BaggageBuilder, processors, TurnContextUtils, ScopeUtils
6. Update all tests to use new naming

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 23, 2026 20:13
@fpfp100 fpfp100 requested review from a team as code owners March 23, 2026 20:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Agent365 Node SDK’s observability attribute schema to align caller identity attributes with OpenTelemetry conventions by moving from legacy microsoft.caller.* keys to standard user.* keys, and by renaming “UPN” terminology to “email” across contracts, constants, baggage builders, hosting utilities, and tests.

Changes:

  • Renamed caller attribute constants to user.id, user.name, user.email and updated all usages in scopes/processors and hosting utilities.
  • Renamed agent/caller-agent “UPN” constants and contract fields to “email” equivalents (agentEmail, GEN_AI_AGENT_EMAIL_KEY, GEN_AI_CALLER_AGENT_EMAIL_KEY).
  • Updated unit tests and changelog to reflect the breaking API/contract updates.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/observability/extension/hosting/scope-utils.test.ts Updates hosting scope utility tests to assert new user.* and *email* constants/fields.
tests/observability/extension/hosting/output-logging-middleware.test.ts Validates output span attributes now use OpenTelemetryConstants.USER_* keys.
tests/observability/extension/hosting/baggage-middleware.test.ts Updates baggage assertions from legacy caller keys to user.id.
tests/observability/extension/hosting/BaggageBuilderUtils.test.ts Updates baggage builder utility expectations to new user.* and agent email keys.
tests/observability/core/scopes.test.ts Updates core scope tests to use renamed CallerDetails fields and user.* attribute keys.
tests/observability/core/SpanProcessor.test.ts Updates processor attribute set expectations to include USER_* and new agent/caller-agent email keys.
packages/agents-a365-observability/src/tracing/scopes/OpenTelemetryScope.ts Writes caller identity tags using user.* keys and agent identity using agent email key.
packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts Writes caller-agent identity email tag via new caller-agent email key.
packages/agents-a365-observability/src/tracing/processors/util.ts Updates the generic/invoke-agent attribute allowlists to the new key names.
packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts Renames fluent setters to userId/userName/userEmail and agentEmail.
packages/agents-a365-observability/src/tracing/contracts.ts Renames AgentDetails.agentUPNagentEmail and CallerDetails.caller*user*.
packages/agents-a365-observability/src/tracing/constants.ts Introduces USER_* constants and replaces UPN keys with email equivalents.
packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts Emits caller baggage using user.* keys instead of microsoft.caller.*.
packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts Updates derived agent/caller details to return agentEmail and user* fields.
CHANGELOG.md Documents the breaking changes and renamed APIs/constants for both packages.

- Remove unused `callerUserId` property from `CallerDetails` (not used
  in source, tests, or dotnet SDK)
- Fix `deriveCallerDetails` JSDoc that incorrectly mentioned "client ip"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fpfp100 fpfp100 merged commit e20f8fb into main Mar 24, 2026
7 checks passed
@fpfp100 fpfp100 deleted the users/pefan/updateuser branch March 24, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants